<?php


namespace app\controller;

use app\common\controller\BaseController;
use app\common\service\content\CategoryService;
use app\common\service\content\ContentService;
use app\common\service\setting\CarouselService;
use app\api\service\IndexService;
use hg\apidoc\annotation as Apidoc;
use think\facade\View;

/**
 * @Apidoc\Title("首页")
 * @Apidoc\Group("index")
 * @Apidoc\Sort("100")
 */
class Showroom extends BaseController
{
    /**
     * @Apidoc\Title("首页")
     * @Apidoc\NotHeaders()
     * @Apidoc\NotQuerys()
     * @Apidoc\NotParams()
     */
    public function index()
    {
        $pathinfo = $this->request->pathinfo(); // 获取路径信息 "news/industry?page=1"
        $path = getUrlPath($pathinfo);
        $info = CategoryService::getUrlId($path);

        $id = 6;
        if (!empty($info)) {
            $id = $info['category_id'];
        } else {
            $info = CategoryService::info(6);
        }
        $page = request()->param('page', 1);
        $menu = CategoryService::getSubMenu(23);
        View::assign('menu', $menu);
        $ids = CategoryService::getSubMenuIds($id);


        $where[] = ['category_ids', 'in', $ids];
        $where[] = ['type', '=', 17];
        $field = 'm.content_id,unique,image_id,type,description,remark,name,release_time,hits,is_top,is_hot,is_rec,is_disable,create_time,update_time';

        $list =   ContentService::lis($where, $page, 12,[],$field,'image_url_list');

        View::assign('list', $list);
        View::assign('info', $info);

if($id==31){
    return view('showroom/md');
}else{
    return view('showroom/al');
}
     
    }
    public function cases()
    {
        $menu = CategoryService::getSubMenu(23);
        View::assign('menu', $menu);
        return view('al');
    }
    public function stores()
    {
        $menu = CategoryService::getSubMenu(23);
        View::assign('menu', $menu);
        return view('md');
    }
}
